<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title></title>
</head>

<body>
<script type="text/javascript">
    function cal(biryear,birmonth,birday){
        var result = "周星星从出生到现在已度过了<br>";
        var now = new Date;
        var bir = new Date(biryear,birmonth-1,birday);
        var cha = now - bir;
        var day = cha / 86400000;
        var days = parseInt(day);
        var hour = (cha % 86400000) / 3600000;
        var hours = parseInt(hour);
        var minute = (cha % 86400000 % 3600000) / 60000;
        var minutes = parseInt(minute);
        var second = (cha % 86400000 % 3600000 % 60000)/ 1000;
        var seconds = parseInt(second);
        result += days + "天 >>>" + hours + "小时 >>>" + minutes + "分 >>>" + seconds + "秒";
        return result;
    }
    document.write(cal(1996,6,9));
</script>
</body>
</html>
